import React from 'react'
import { Card, Space, Button, Checkbox, Form, Input } from 'antd';

export default function Login(props) {
  const onFinish = values => {
    //存储token
    localStorage.setItem('token',values.username)
    //跳转到首页
    props.history.push('/admin/home')
  };
  return (
    <div>
      <Card title="蜜雪冰城登录页面" style={{ width: 300, margin: '100px auto' }}>
        <Form onFinish={onFinish} >
          <Form.Item
            name="username"
            rules={[{ required: true, message: '用户名错误!' }]}
          >
            <Input placeholder='请输入用户名' />
          </Form.Item>

          <Form.Item
            name="password"
            rules={[{ required: true, message: '密码错误!' }]}
          >
            <Input.Password placeholder='请输入密码' />
          </Form.Item>

          <Form.Item>
            <Button type="primary" htmlType="submit" block>
              登录
            </Button>
          </Form.Item>
        </Form>
      </Card>
    </div>
  )
}
